define(['jquery', 'swfobject'], function ($) {
	$('.js-player').each(function () {
		$(this).removeClass("js-player");
		// http://git.oschina.net/hongweizhiyuan/CuPlayerMini/tree/master/CuPlayerMiniV4
		// http://www.cuplayer.com/Cu/CuPlayerMiniV4/help/index.html
		var me = this,
			path = me.getAttribute('data-path') || 'http://admin.geely.com/upload/201304/586d9cecdddd9b512990eeb5150f5b57.flv',
			context = (window.Macnito || window)['contextPath'] || '',
			swf = require.toUrl('../lib/CuPlayer/CuPlayerMiniV4.swf'),
			width = 765,
			height = 468,
			version = '9.0.0',
			eiSwf = 'expressInstall.swf',
			flashvars = {
				CuPlayerSetFile: '/js/lib/CuPlayer/CuPlayerSetFile.xml', // 默认配置文件地址
				CuPlayerFile: path,     // 视频播放地址
				CuPlayerImage: '/js/lib/CuPlayer/images/start.jpg',      // 视频缩略图
				CuPlayerWidth: '600',
				CuPlayerHeight: '410',
				CuPlayerAutoPlay: 'no',           // yes/no 是否自动播放
				CuPlayerLogo: '/js/lib/CuPlayer/images/Logo.png',  // logo 地址
				CuPlayerPosition: 'top-right'     // logo 显示位置
			},
		// flash params
			params = {
				wmode: 'transparent'
			},
		// element attributes
			attrs = {
				allowfullscreen: true,
				allowscriptaccess: 'always',
				wmode: 'opaque',
				quality: 'high',
				salign: 'lt',
				name: 'CuPlayer',
				bgcolor: '#000'
			},
			success = function () {
			},
			error = function () {
			};

		console.log(path);
		if (!me.id) {
			me.id = 'js-player-' + new Date().getTime() + Math.round(Math.random() * 1E5);
		}

		swfobject.embedSWF(
			swf,
			me.id,
			width,
			height,
			version,
			eiSwf,
			flashvars,
			params,
			attrs,
			success,
			error
		);
	});
});
